﻿using System;
using System.Collections.Generic;
using System.Text;

using System.IO;
using System.Web;

namespace Tickz
{
    public class FileTool
    {
        /// <summary>
        /// 读取文件 默认编码是gb2312
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static string readFileByPath(string filePath)
        {
            return readFileByPathAndEncode(filePath,"gb2312");
        }
        /// <summary>
        /// 读取指定路径，文件编码的内容
        /// </summary>
        /// <param name="path"></param>
        /// <param name="encode"></param>
        /// <returns></returns>
        public static string readFileByPathAndEncode(string filePath,string encode)
        {
            StreamReader sr = null;
            string str = null;
            try
            {
                sr = new StreamReader(filePath, Encoding.GetEncoding(encode));
                str=sr.ReadToEnd();
            }
            finally
            {
                sr.Close();
            }
            return str;
        }

        public static void wirteContentToFile(string filePath,string encode)
        {
            StreamWriter sw = null;

            
            
        }
    }
}
